<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file ="../include/base.jsp"%>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" type="text/css"  href="<%=basePath %>css/bootstrap.min.css"/>
	<link rel="stylesheet" type="text/css"  href="<%=basePath %>css/task.css"/>
	<link rel="stylesheet" type="text/css" href="<%=basePath %>css/datepicker.css" />
	<title>凯胜项目管理系统</title>
	<style type="text/css">
		body{
			padding-top:50px;
		}
		.mywell{
			margin-top:25px;
		}
	</style>
</head>
<body class="body">
	
	<%@ include file = "../include/sametop.jsp" %>
	<div class="container">
		<div class="row">
		<jsp:include page="../include/sameleft.jsp">
			<jsp:param value="deal" name="tag"/>
		</jsp:include>
			<div class="span9">
			
				<ul class="breadcrumb" style="height:30px;margin-bottom:0px;margin-top:25px;border-radius:3px 3px 0 0;border:1px solid #dddddd"">
					<li class="active" style="margin-top:8px">
						<a href="task.html" style="font-size:16px"><i class="icon-th"></i>交易机会</a>
					</li>
					<li style = "float:right">
					<span style = "color:#08c">搜索交易:</span><input type="text" value = "搜索交易" style="color:#cccccc;border-radius:10px 10px" />
					
					</li>
					<li style="float:right"></li>
				</ul>
			
				<div class="wall" style="height:520px;border-top:none; border:1px solid #dddddd">
				<div style="margin-top:20px" >
					<a  href="<%=basePath %>deal/add.action" class="btn btn-success" style = "color:#ccccc;width:110px;border-radius:10px 10px 10px 10px;margin-left:20px;"><i class="icon-plus" ></i>添加交易机会</a> 
					<div style="margin-left:50px;display:inline">显示所有交易
					<ul style = "display:inline" class="dropdown nav">
						<a class="dropdown-toggle " data-toggle="dropdown" href="#">根据类别</a>
						<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
						   <li>xxx</li><li>xxx</li><li>xxx</li>
						</ul>
					</ul>
					<div style = "display:inline" class="dropdown navb">
						<a class="dropdown-toggle  " data-toggle="dropdown" href="#">根据人</a>
						<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
						   <li>xxx</li><li>xxx</li><li>xxx</li>
						</ul>
					</div>
					<div style = "display:inline" class="dropdown">
						<a class="dropdown-toggle " data-toggle="dropdown" href="#">根据时间</a>
						<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
						   <li>xxx</li><li>xxx</li><li>xxx</li>
						</ul>
					</div> 
					</div>
					
					
				</div>
				<div style = "margin-top:20px">
				
					<ul class="nav nav-tabs">
					  <li style = "border-right:1px solid #cccccc"><a style = "pointer:curson" id = "pending" href="javaScript:;" data-toggle="tab">跟踪的交易</a></li>
					  <li style = "border-right:1px solid #cccccc"><a href="javaScript:;" data-toggle="tab" id = "woning">赢得的交易</a></li>
					  <li><a id = "losting" href="javaScript:;" data-toggle="tab">失去的交易</a></li>
					</ul>
					<div id = "pend">
						<c:choose>
							<c:when test="${empty page.result }">
								<span style='margin-left:20px;'>暂时无相关交易</span>
							
							</c:when>
							<c:otherwise>
								<c:forEach items="${page.result }" var="deal">
							<div class = "mpar">
							<div class = "row toshowEditDel"style = "margin-left:20px;margin-top:20px">
								<div class = "span1" ><img src="<%=basePath %>img/10.png" style = "box-shadow:20px,20px"alt="" /></div>
								<div class = "span6"><span style = "font-size:24px;font-weight:bold;color:#08c"><a href = "<%=basePath%>deal/singledeal.action?id=${deal.id}">${deal.name}</a></span></a></span>&nbsp;<span>with&nbsp;&nbsp;${deal.contactname}</span><br />总金额：${deal.price}<span class = "showEditDel" style = "float:right;display:none"><a href="javaScript:;" class="delDeal" id="${deal.id}" ><i class="icon-trash"></i></a><a class ="editDeal" href="<%=basePath %>deal/editDeal.action?id=${deal.id}" id="${deal.id}"><i class="icon-pencil"></i>编辑此交易</a></span></div>
								
							</div>
							<div class="xian" style = "border:1px solid #cdcdcd;width:600px;margin-left:20px"></div>	
							</div>
						</c:forEach>
							
							
							</c:otherwise>
						
						
						</c:choose>
						
					</div>
<!-- 					<span style = "margin-left:20px;"><span style="font-weight:bold">[交易个数]:</span>3个 &nbsp;&nbsp;&nbsp;<span style="font-weight:bold">[总金额]:</span>20000 </span><div style = "border:1px solid #cccccc;width:600px;margin-top:10px"></div>
 -->				</div>
		</div>
	</div>
	</div>
	<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>
	<script type="text/javascript" src="http://lib.sinaapp.com/js/bootstrap/2.0.3/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/task.js"></script>
	<script type="text/javascript" src ="<%=basePath %>js/bootstrap-datepicker.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$('#settimebtn').click(function(){
				$("#selecttime").hide();
				$("#settimeinput").show();
			});
			$('#settimebtn').datepicker().on('changeDate',function(ev){
				$("#settimeinput").attr("value",$('#settimebtn').data('date'));
			});
			
			$(".delDeal").live("click",function(data){
				if(confirm("你确定要删除吗？")){
				var id = $(this).attr("id");
				$.get("<%=basePath%>deal/delDeal.action?id="+id,function(data){
					
				
				
				});
				$(this).parent().parent().parent().parent().remove();
				
			}
			
			});
			
			$("#woning").click(function(){
				var v = "won";
				get(v);
			});
			$("#pending").click(function(){
				var v = "pend";
				get(v);
			});
			$("#losting").click(function(){
				var v = "lost";
				get(v);
			});
			function get(v){
				$.get("<%=basePath %>deal/dealList.action?progress="+v,function(data){
					$("#pend").empty();
					var val = data.result;
					if(val.length<=0){
						$("#pend").append($("<div style = 'margin-left:100px'>暂时没有相关的交易</div>"));
					}else{
						for(var i=0;i<val.length;i++){
						$("#pend").append($("<div class = 'mpar'><div class = 'row toshowEditDel' style = 'margin-left:20px;margin-top:20px'><div class = 'span1' ><img src='<%=basePath %>img/10.png' style = 'box-shadow:20px,20px'/></div><div class = 'span6' style = 'margin-left:30px;margin-top:5px'><a href = '<%=basePath%>deal/singledeal.action?id="+val[i].id+"' ><span  style = 'font-size:24px;font-weight:bold;color:#08c'>"+val[i].name+"</span></a>&nbsp;<span>with&nbsp;&nbsp;"+val[i].contactname+"</span><br />总金额："+val[i].price+"<span class = 'showEditDel' style = 'float:right;display:none'><a href='javaScript:;' class='delDeal' id = '"+val[i].id+"'><i class='icon-trash'></i></a><a class ='editDeal' href='<%=basePath%>deal/editDeal.action?id="+val[i].id+"' id = '"+val[i].id+"'><i class='icon-pencil'></i>编辑此交易</a></span></div></div><div class = 'xian' style = 'border:1px solid #cdcdcd;width:600px;margin-left:20px'></div></div>"));
						//$("#pend").append($("<div class = 'xian' style = 'border:1px solid #cdcdcd;width:600px;margin-left:20px'></div>"));	
					}
					}
					
				});
			}
			$(".toshowEditDel").live("mousemove",function(){
				$(this).children(".span6").children(".showEditDel").show();
			});
			$(".toshowEditDel").live("mouseout",function(){
				$(this).children(".span6").children(".showEditDel").hide();
			});
		});
		function player(id){
			 var id=document.getElementById(id);
			id.style.display="block"; 
			
		}
		function clocer(id){
			 var id=document.getElementById(id);
			id.style.display="none"; 
			
		}
		
	</script>
</body>
</html>
